ModEditor.Windows.ObjectControl = ModEditor.GUI.BasicWindow:New()
ModEditor.Windows.ObjectControl:Apply({{"Caption","Object List"},{"X",10},{"Y",10},{"Width",250},{"Height",500},{"ShowFullWindow",true},{"Visible",true}})

ModEditor.Windows.ObjectControl.ObjectList = ModEditor.GUI.ListBox:New(ModEditor.Windows.ObjectControl)
ModEditor.Windows.ObjectControl.ObjectList:Apply({{"X",10},{"Y",30},{"Width",ModEditor.Windows.ObjectControl.Width-20},{"Height",200},{"MultiSelection",true}})

ModEditor.Windows.ObjectControl.AddButton = ModEditor.GUI.Button:New(ModEditor.Windows.ObjectControl)
function ModEditor.Windows.ObjectControl.AddButton:OnClick()
	ModEditor.Windows.ObjectControl.Child = ModEditor.Windows.AddObject.New()
end
ModEditor.Windows.ObjectControl.AddButton:Apply({{"X",10},{"Y",240},{"Width",32},{"Height",20},{"Caption","Add"}})

ModEditor.Windows.ObjectControl.RemoveButton = ModEditor.GUI.Button:New(ModEditor.Windows.ObjectControl)
function ModEditor.Windows.ObjectControl.RemoveButton:OnClick()
	local ObjectsToRemove = {}
	for i = 1,#ModEditor.Windows.ObjectControl.ObjectList.Items do
		if ModEditor.Windows.ObjectControl.ObjectList.Items[i][2] then
			table.insert(ObjectsToRemove,i)
		end
	end
	for i = 1,#ObjectsToRemove do
		table.remove(ModEditor.Windows.ObjectControl.ObjectList.Items,ObjectsToRemove[#ObjectsToRemove-i+1])
		table.remove(ModEditor.ObjectList,ObjectsToRemove[#ObjectsToRemove-i+1])
		if ModEditor.Windows.ObjectControl.ObjectList.SelectedItem == #ObjectsToRemove-i+1 then
			ModEditor.Windows.ObjectControl.ObjectList.SelectedItem = 0
		end
	end
end
ModEditor.Windows.ObjectControl.RemoveButton:Apply({{"X",52},{"Y",240},{"Width",62},{"Height",20},{"Caption","Remove"}})

ModEditor.Windows.ObjectControl.RenameButton = ModEditor.GUI.Button:New(ModEditor.Windows.ObjectControl)
function ModEditor.Windows.ObjectControl.RenameButton:OnClick()
	ModEditor.Windows.ObjectControl.Child = ModEditor.Windows.RenameObject.New()
end
ModEditor.Windows.ObjectControl.RenameButton:Apply({{"X",124},{"Y",240},{"Width",62},{"Height",20},{"Caption","Rename"}})

ModEditor.Windows.ObjectControl:AddControl(ModEditor.Windows.ObjectControl.ObjectList)
ModEditor.Windows.ObjectControl:AddControl(ModEditor.Windows.ObjectControl.AddButton)
ModEditor.Windows.ObjectControl:AddControl(ModEditor.Windows.ObjectControl.RemoveButton)
ModEditor.Windows.ObjectControl:AddControl(ModEditor.Windows.ObjectControl.RenameButton)
ModEditor.Windows.Add(ModEditor.Windows.ObjectControl)
